package cn.doit.scala.day02.tuple

import scala.io.Source

/**
 * @DATE 2021/12/25/16:34
 * @Author MDK
 * @Version 2021.2.2
 * */
object C01_Tuple02 {
  def main(args: Array[String]): Unit = {
    val stus = for (line <- Source.fromFile("data/stu.txt").getLines()) yield {
      val arr: Array[String] = line.split("\\s+")
      //将数据封装在元组中
      (arr(0),arr(1),arr(2).toDouble)
    }
    val list: List[(String, String, Double)] = stus.toList
    for (elem <- list) {
      if("娜娜".equals(elem._1)){
        println(elem._2, elem._3)
      }
    }
  }
}
